﻿Date.prototype.isLeapYear = function() {
	return(0 == this.getYear() % 4 && ((this.getYear() % 100 != 0) || (this.getYear() % 400 == 0)))
};
Date.prototype.Format = function(a) {
	var b = a;
	var c = ["日", "一", "二", "三", "四", "五", "六"];
	b = b.replace(/yyyy|YYYY/, this.getFullYear());
	b = b.replace(/yy|YY/, (this.getYear() % 100) > 9 ? (this.getYear() % 100).toString() : "0" + (this.getYear() % 100));
	b = b.replace(/MM/, this.getMonth() > 9 ? this.getMonth().toString() : "0" + this.getMonth());
	b = b.replace(/M/g, this.getMonth());
	b = b.replace(/w|W/g, c[this.getDay()]);
	b = b.replace(/dd|DD/, this.getDate() > 9 ? this.getDate().toString() : "0" + this.getDate());
	b = b.replace(/d|D/g, this.getDate());
	b = b.replace(/hh|HH/, this.getHours() > 9 ? this.getHours().toString() : "0" + this.getHours());
	b = b.replace(/h|H/g, this.getHours());
	b = b.replace(/mm/, this.getMinutes() > 9 ? this.getMinutes().toString() : "0" + this.getMinutes());
	b = b.replace(/m/g, this.getMinutes());
	b = b.replace(/ss|SS/, this.getSeconds() > 9 ? this.getSeconds().toString() : "0" + this.getSeconds());
	b = b.replace(/s|S/g, this.getSeconds());
	return b
};

function daysBetween(b, c) {
	var e = b.substring(5, b.lastIndexOf("-"));
	var d = b.substring(b.length, b.lastIndexOf("-") + 1);
	var f = b.substring(0, b.indexOf("-"));
	var h = c.substring(5, c.lastIndexOf("-"));
	var g = c.substring(c.length, c.lastIndexOf("-") + 1);
	var i = c.substring(0, c.indexOf("-"));
	var a = ((Date.parse(e + "/" + d + "/" + f) - Date.parse(h + "/" + g + "/" + i)) / 86400000);
	return Math.abs(a)
}
Date.prototype.DateAdd = function(c, b) {
	var a = this;
	switch(c) {
		case "s":
			return new Date(Date.parse(a) + (1000 * b));
		case "n":
			return new Date(Date.parse(a) + (60000 * b));
		case "h":
			return new Date(Date.parse(a) + (3600000 * b));
		case "d":
			return new Date(Date.parse(a) + (86400000 * b));
		case "w":
			return new Date(Date.parse(a) + ((86400000 * 7) * b));
		case "q":
			return new Date(a.getFullYear(), (a.getMonth()) + b * 3, a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds());
		case "m":
			return new Date(a.getFullYear(), (a.getMonth()) + b, a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds());
		case "y":
			return new Date((a.getFullYear() + b), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds())
	}
};
Date.prototype.DateDiff = function(c, a) {
	var b = this;
	if(typeof a == "string") {
		a = StringToDate(a)
	}
	switch(c) {
		case "s":
			return parseInt((a - b) / 1000);
		case "n":
			return parseInt((a - b) / 60000);
		case "h":
			return parseInt((a - b) / 3600000);
		case "d":
			return parseInt((a - b) / 86400000);
		case "w":
			return parseInt((a - b) / (86400000 * 7));
		case "m":
			return(a.getMonth() + 1) + ((a.getFullYear() - b.getFullYear()) * 12) - (b.getMonth() + 1);
		case "y":
			return a.getFullYear() - b.getFullYear()
	}
};
Date.prototype.toString = function(b) {
	var a = this;
	var c = a.toLocaleDateString();
	if(b) {
		var d = ["日", "一", "二", "三", "四", "五", "六"];
		c += " 星期" + d[a.getDay()]
	}
	return c
};

function CheckDateTime(e) {
	var c = /^(\d+)-(\d{ 1,2 })-(\d{ 1,2 }) (\d{ 1,2 }):(\d{ 1,2 }):(\d{ 1,2 })$/;
	var b = e.match(c);
	if(b == null) {
		return false
	}
	b[2] = b[2] - 1;
	var a = new Date(b[1], b[2], b[3], b[4], b[5], b[6]);
	if(a.getFullYear() != b[1]) {
		return false
	}
	if(a.getMonth() != b[2]) {
		return false
	}
	if(a.getDate() != b[3]) {
		return false
	}
	if(a.getHours() != b[4]) {
		return false
	}
	if(a.getMinutes() != b[5]) {
		return false
	}
	if(a.getSeconds() != b[6]) {
		return false
	}
	return true
}
Date.prototype.toArray = function() {
	var b = this;
	var a = Array();
	a[0] = b.getFullYear();
	a[1] = b.getMonth();
	a[2] = b.getDate();
	a[3] = b.getHours();
	a[4] = b.getMinutes();
	a[5] = b.getSeconds();
	return a
};
Date.prototype.DatePart = function(a) {
	var b = this;
	var c = "";
	var d = ["日", "一", "二", "三", "四", "五", "六"];
	switch(a) {
		case "y":
			c = b.getFullYear();
			break;
		case "m":
			c = b.getMonth() + 1;
			break;
		case "d":
			c = b.getDate();
			break;
		case "w":
			c = d[b.getDay()];
			break;
		case "ww":
			c = b.WeekNumOfYear();
			break;
		case "h":
			c = b.getHours();
			break;
		case "n":
			c = b.getMinutes();
			break;
		case "s":
			c = b.getSeconds();
			break
	}
	return c
};
Date.prototype.MaxDayOfDate = function() {
	var d = this;
	var a = d.toArray();
	var b = (new Date(a[0], a[1] + 1, 1));
	var c = b.dateAdd(1, "m", 1);
	var e = dateDiff(b.Format("yyyy-MM-dd"), c.Format("yyyy-MM-dd"));
	return e
};
Date.prototype.WeekNumOfYear = function() {
	var d = this;
	var a = d.toArray();
	var e = a[0];
	var c = a[1] + 1;
	var b = a[2];
	document.write("< script language=VBScript> \n");
	document.write("myDate = DateValue(" + c + "-" + b + "-" + e + ") \n");
	document.write("result = DatePart(ww, myDate) \n");
	document.write(" \n");
	return result
};

function StringToDate(c) {
	var b = Date.parse(c);
	var d = new Date(b);
	if(isNaN(d)) {
		var a = c.split("-");
		d = new Date(a[0], --a[1], a[2])
	}
	return d
};
(function(j) {
	var k = "unobtrusiveAjaxClick",
		p = "unobtrusiveValidation";

	function l(h, f) {
		var e = window,
			g = (h || "").split(".");
		while(e && g.length) {
			e = e[g.shift()]
		}
		if(typeof e === "function") {
			return e
		}
		f.push(h);
		return Function.constructor.apply(null, f)
	}

	function m(b) {
		return b === "GET" || b === "POST"
	}

	function o(d, c) {
		!m(c) && d.setRequestHeader("X-HTTP-Method-Override", c)
	}

	function q(f, a, h) {
		var g;
		if(h.indexOf("application/x-javascript") !== -1) {
			return
		}
		g = (f.getAttribute("data-ajax-mode") || "").toUpperCase();
		j(f.getAttribute("data-ajax-update")).each(function(i, b) {
			var d;
			switch(g) {
				case "BEFORE":
					d = b.firstChild;
					j("<div />").html(a).contents().each(function() {
						b.insertBefore(this, d)
					});
					break;
				case "AFTER":
					j("<div />").html(a).contents().each(function() {
						b.appendChild(this)
					});
					break;
				default:
					j(b).html(a)
			}
		})
	}

	function n(a, c) {
		var h, s, d, f;
		h = a.getAttribute("data-ajax-confirm");
		if(h && !window.confirm(h)) {
			return
		}
		s = j(a.getAttribute("data-ajax-loading"));
		f = a.getAttribute("data-ajax-loading-duration") || 0;
		j.extend(c, {
			type: a.getAttribute("data-ajax-method") || undefined,
			url: a.getAttribute("data-ajax-url") || undefined,
			beforeSend: function(e) {
				var b;
				o(e, d);
				b = l(a.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments);
				b !== false && s.show(f);
				return b
			},
			complete: function() {
				s.hide(f);
				l(a.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments)
			},
			success: function(b, i, g) {
				q(a, b, g.getResponseHeader("Content-Type") || "text/html");
				l(a.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments)
			},
			error: l(a.getAttribute("data-ajax-failure"), ["xhr", "status", "error"])
		});
		c.data.push({
			name: "X-Requested-With",
			value: "XMLHttpRequest"
		});
		d = c.type.toUpperCase();
		if(!m(d)) {
			c.type = "POST";
			c.data.push({
				name: "X-HTTP-Method-Override",
				value: d
			})
		}
		j.ajax(c)
	}

	function r(d) {
		var a = j(d).data(p);
		return !a || !a.validate || a.validate()
	}
	j("a[data-ajax=true]").live("click", function(b) {
		b.preventDefault();
		n(this, {
			url: this.href,
			type: "GET",
			data: []
		})
	});
	j("form[data-ajax=true] input[type=image]").live("click", function(a) {
		var s = a.target.name,
			b = j(a.target),
			i = b.parents("form")[0],
			h = b.offset();
		j(i).data(k, [{
			name: s + ".x",
			value: Math.round(a.pageX - h.left)
		}, {
			name: s + ".y",
			value: Math.round(a.pageY - h.top)
		}]);
		setTimeout(function() {
			j(i).removeData(k)
		}, 0)
	});
	j("form[data-ajax=true] :submit").live("click", function(a) {
		var f = a.target.name,
			b = j(a.target).parents("form")[0];
		j(b).data(k, f ? [{
			name: f,
			value: a.target.value
		}] : []);
		setTimeout(function() {
			j(b).removeData(k)
		}, 0)
	});
	j("form[data-ajax=true]").live("submit", function(b) {
		var a = j(this).data(k) || [];
		b.preventDefault();
		if(!r(this)) {
			return
		}
		n(this, {
			url: this.action,
			type: this.method || "GET",
			data: a.concat(j(this).serializeArray())
		})
	})
})(jQuery);
document.domain = "vancl.com";
$(function() {
	var a = $('<div id="imdiv"><img hspace="6" src="http://i.vanclimg.com/others/2011/11/9/icon.gif" align="absmiddle" /><a style="padding-right:8px;" href="http://imweb.vancl.com" id="impage" target="_blank">在线客服</a><a href="#"><img src="http://i.vanclimg.com/others/2011/11/9/top.gif" hspace="3" align="absmiddle" /></a></div>').attr("style", "width:112px; height:25px; padding-top:3px;float:right; background:url(http://i.vanclimg.com/others/2011/11/9/bg.gif) center no-repeat; position:fixed;_position:absolute;_bottom:auto; right:0; bottom:0;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))");
	$("body").append(a);
	$("#im").live("click", function() {
		$(this).prev("img").attr("http://i.vanclimg.com/others/2011/11/9/icon.gif");
		var b = $("#imiframe");
		if(b.length == 0) {
			b = $("<iframe />");
			b.attr("id", "imiframe").attr("src", $(this).attr("href")).attr("frameborder", "0").attr("scrolling", "no").css({
				width: 641,
				height: 480,
				bottom: 0,
				right: 0,
				position: "fixed",
				"z-index": 9999
			}).attr("style", "width:641px; height:480px;z-index:9999;position:fixed; _position:absolute;_bottom:auto; right:0; bottom:0;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))").appendTo("body")
		}
		b.show();
		return false
	});
	window.hidePanel = function() {
		$("#im").prev("img").attr("src", "http://i.vanclimg.com/others/2011/11/9/icon.gif");
		$("#imiframe").hide()
	};
	window.closePanel = function() {
		$("#im").prev("img").attr("src", "http://i.vanclimg.com/others/2011/11/9/icon.gif");
		$("#imiframe").remove()
	};
	window.toTop = function() {
		window.scrollTo(0, 0)
	};
	window.notifyNewMessage = function() {
		$("#im").prev("img").attr("src", "http://i.vanclimg.com/others/2011/11/9/gif.gif")
	}
});
var isIE = $.browser.msie;
var isIE6 = false;
var iniSelect = "";
$(function() {
	$("#posttime").change(changePostTime);
	$("#myTab>a").click(changeTab);
	if(window.GetRemmendList) {
		GetRemmendList($("#product-code-list").val(), $("#rows").val(), $("#userid").val(), $("#recm-type").val(), $("input#type").val())
	}
	iniSelect = $("#Info_List").html()
});

function getInitOrderList() {
	$("#LoadingDiv").show();
	var a = "/order/orderlist4?id=1&datestring=" + escape("30天内的订单") + "&orderstatus=" + escape($("#QueryStatus").val()) + "&hidPostTime=" + $("#posttime").val() + "&_=" + Math.random();
	if($("#hidFormCodeM").val() != 0) {
		a += "&formCodeM=" + $("#hidFormCodeM").val()
	}
	$.get(a, function(b) {
		$("#orderlist").html(b);
		$("#LoadingDiv").hide()
	})
}

function getLabelCount() {
	var a = "/order/GetLabelCount?hidPostTime=" + $("#posttime").val() + "&ran=" + Math.random();
	$.ajax({
		type: "GET",
		url: a,
		success: function(b) {
			$("#myTab a").eq(0).find("span").html("").html("(" + b.TotalCount + ")");
			$("#myTab a").eq(1).find("span").html("").html("(<span>" + b.InCompleteCount + "</span>)");
			$("#myTab a").eq(2).find("span").html("").html("(" + b.CompleteCount + ")");
			$("#myTab a").eq(3).find("span").html("").html("(<span>" + b.InvalidCount + "</span>)")
		},
		dataType: "JSON",
		error: function(d, c, b) {}
	})
}

function UpdateSumTags() {}

function ClearList() {
	$("#orderlist .orderinfo").html("")
}

function changePostTime() {
	var a = $("#posttime").val();
	$("#hidPostTime").val(a);
	$("#datestring").val($("#posttime>option[value='" + a + "']").text());
	$("#orderstatus").val($("#myTab .wtitle_lNa").text());
	$("#isPageing").val(false);
	getLabelCount();
	$("#form0").submit()
}

function changeTab() {
	if($(this).text() == $("#myTab .wtitle_lNa").text()) {
		return
	}
	var b = $("#myTab>a");
	var a = $(this).index();
	for(i = 0; i < b.length; i++) {
		$(b[i]).removeClass("wtitle_lNa")
	}
	$(this).addClass("wtitle_lNa");
	if($.trim($(this).text()).indexOf("进行中") > -1) {
		$("#hidPostTime").val($("#posttime").val());
		$("#posttime").hide()
	} else {
		$("#posttime").show();
		$("#hidPostTime").val($("#posttime").val())
	}
	$("#datestring").val($("#posttime>option[value='" + $("#posttime").val() + "']").text());
	$("#orderstatus").val($(this).text());
	$("#isPageing").val(true);
	if($.trim($(this).text()).indexOf("进行中") > -1) {
		getLabelCount()
	}
	$("#form0").submit()
}

function PhotoShow(f, b) {
	var g = $(f).parent().parent();
	var c = g.prevAll("li").length;
	var h = g.find(".product .product-ul");
	var e = h.find("li").length;
	var a = h.parent().parent().parent().parent().parent().parent().parent();
	var d = a.length > 0 ? true : false;
	if(e <= 3) {
		$.ajax({
			async: false,
			type: "GET",
			cache: false,
			dataType: "html",
			url: "/Order/ProductPhoto/" + b,
			success: function(j) {
				if(j != "") {
					h.html(j);
					$(f).removeClass("product_an").addClass("product_an_up");
					if(d) {}
				}
			},
			error: function() {}
		})
	} else {
		h.find("li:gt(2)").remove();
		$(f).removeClass("product_an_up").addClass("product_an");
		if(d) {}
	}
	if($.browser.msie) {
		ResetOrderHeight()
	}
	return false
}

function SetLocations(e, b) {
	var c = e.parent().parent().parent().parent().parent();
	var d = c.outerHeight(true);
	var a = (d - c.find("dd:eq(0)").height()) / 2;
	c.find("dd:eq(0)").css("margin-top", parseInt(c.find("dd:eq(0)").attr("orgtop")));
	c.find("dd:gt(0)").each(function() {
		if(e.find("li").length < 4) {
			var h = parseInt($(this).attr("orgtop"));
			$(this).css("margin-top", h)
		} else {
			var g = $(this).height();
			var f = (d - g) / 2 - 10;
			if($(this).attr("class") == "widdent_w5") {
				if($(this).parent().find(".widdent_w5 ul>li").length <= 1) {
					if($(this).find("a[name^='my_IsReturnInfo']").length == 0 && $(this).find("li[name^='my_IsReturnInfo'] a").length == 0) {
						f = f + 3
					} else {
						if($(this).find("a[name^='shaidan']").length > 0) {
							f = f + 4
						} else {
							f = f - 10
						}
					}
				} else {
					if($(this).parent().find(".widdent_w5 ul>li").length < 3) {
						if($(this).find("a[name^='my_IsReturnInfo']").length > 0 || $(this).find("li[name^='my_IsReturnInfo'] a").length > 0) {
							f = f - 10
						}
					}
				}
			}
			$(this).css("margin-top", f)
		}
	})
}

function SetLocation(e, b) {
	var c = GetMarginTop(e.find("li").length);
	var d = e.parent().parent().find(".wid_id");
	d.css("margin-top", c);
	var a = e.parent().parent().find("[class^=product_an]");
	if($.browser.msie) {
		if($.browser.version == 6 || $.browser.version == 7) {
			c = c - 10
		}
	}
	a.css("margin-top", c);
	SetLocations(e, b)
}

function GetMarginTop(a) {
	if(a > 6) {
		return 76
	} else {
		if(a > 3) {
			return 48
		} else {
			return 20
		}
	}
}

function DisplayCanceDivNew(n, l, g, e) {
	$("#hidHavePaid").val(g);
	var p = $("#" + l).parent().parent().parent().parent().find(".widdent_w1 ul li .wid_id").length;
	$("#cancelordernum").val(p);
	$("input[name='cancelreason']:checked").each(function() {
		$(this).attr("checked", false)
	});
	$("#txtCancelReason").val("");
	$(".deleteOrder_Area").hide();
	var k = $("#canceDivNew");
	var m = $(e).offset();
	var b = parseInt(m.top) - 90;
	var a = parseInt(m.left) - parseInt(k.width());
	document.getElementById("canceDivNew").style.top = b + "px";
	document.getElementById("alertOrderDivNew").style.top = b + "px";
	document.getElementById("canceDivNew").style.left = a + "px";
	document.getElementById("alertOrderDivNew").style.left = a + "px";
	$("#TxtOid").attr("value", n);
	$("#alertOrderDivNew").css({
		display: "none"
	});
	var j = $("#ulCancelList>li").length;
	var h = $("#ulCancelList>li").last().html();
	var c = [];
	for(var f = 0; f < j - 1; f++) {
		c[f] = f
	}
	var d = c.sort(function(o, r) {
		return Math.random() > 0.5 ? (-1) : 1
	});
	var q = "";
	for(var f = 0; f < d.length; f++) {
		q += "<li>" + $("#ulCancelList>li").eq(d[f]).html() + "</li>"
	}
	q += "<li>" + h + "</li>";
	$("#ulCancelList").html(q);
	$("#canceDivNew").css({
		display: "block"
	})
}

function SelectCancelRadio() {
	if($("input[name='cancelreason']:checked").val() == "11") {
		$(".deleteOrder_Area").show()
	} else {
		$(".deleteOrder_Area").hide()
	}
	$("#txtCancelReason").val("")
}

function ordercanceNew() {
	var a = $("#txtCancelReason").val();
	if($(".deleteOrder_Area").css("display") == "block" && (a == "" || a.length < 1)) {
		$.fn.alert("请填写原因");
		return false
	}
	if($(".deleteOrder_Area").css("display") == "none" && $("#ulCancelList input[name='cancelreason']:checked").length == 0) {
		$.fn.alert("请选择原因");
		return false
	}
	if(a.length > 300) {
		$.fn.alert("您填写的字数超了最大限制");
		return false
	}
	$("#divForSubmit").hide();
	$(".delectOrder_nowTj").show();
	CancelOrderNew()
}

function JumpToMyOrder() {
	CloseAllMenu();
	SubmitAgain()
}

function CloseAllMenu() {
	$(".deleteOrder_Area").hide();
	$("#alertOrderDivNew").hide();
	$("#canceDivNew").hide();
	$("#divForSubmit").show();
	$(".delectOrder_nowTj").hide()
}

function ReShopping() {
	CloseAllMenu();
	window.location.href = "http://www.vancl.com"
}

function ModifyCancelCount() {
	var a = parseInt($.trim($("#myTab a").eq(3).find("span span").html()));
	var b = parseInt($.trim($("#myTab a").eq(1).find("span span").html()));
	$("#myTab a").eq(3).find("span span").html("").html(a + 1);
	$("#myTab a").eq(1).find("span span").html("").html((b - 1) > 0 ? (b - 1) : 0)
}

function SubmitAgain() {
	$("#hidPostTime").val($("#posttime").val());
	$("#datestring").val($("#posttime>option[value='" + $("#posttime").val() + "']").text());
	$("#orderstatus").val($("#myTab .wtitle_lNa").text());
	$("#form0").submit()
}

function CancelOrderNew() {
	var d = $("#TxtOid").val();
	var c = $("#hidHavePaid").val();
	var f = $("#ulCancelList input[name='cancelreason']:checked").next("span").text();
	var b = $("#ulCancelList input[name='cancelreason']:checked").val();
	var a = $("#Cance").val();
	var e = "Order=" + d + "&txt=" + f + "&Info_List=" + b + "&Cance=" + a;
	var g = "/PublicControls/Cancel_Order.ashx";
	$.ajax({
		type: "POST",
		cache: false,
		dataType: "html",
		jsonp: "callback",
		url: g,
		data: e,
		beforeSend: function() {},
		success: function(h) {
			if(h != "") {
				$("#canceDivNew").hide();
				$(".delectOrder_nowTj").hide();
				if(parseInt(h) == 1) {
					$(".deleteOrder_newSelect").show();
					$("#divForSuccess").removeClass("delectOrder_error").find("span").html("成功取消!");
					$("#btnConfirm").addClass("deleteOrder_btn01");
					$("#btnConfirm").unbind("click").live("click", function() {
						CloseAllMenu();
						ModifyCancelCount();
						SubmitAgain()
					});
					if(c == "1") {
						$("#pForAlert").html("").html($("#divForAlert p").eq(0).html()).show()
					} else {
						$("#pForAlert").html("").hide()
					}
				} else {
					if(parseInt(h) == 0) {
						$(".deleteOrder_newSelect").hide();
						$("#btnConfirm").removeClass("deleteOrder_btn01");
						$("#btnConfirm").unbind("click").live("click", function() {
							CloseAllMenu();
							SubmitAgain()
						});
						$("#divForSuccess").addClass("delectOrder_error").find("span").html("出错了!");
						$("#pForAlert").html("").html($("#divForAlert p").eq(1).html()).show()
					} else {
						$(".deleteOrder_newSelect").hide();
						$("#btnConfirm").removeClass("deleteOrder_btn01");
						$("#btnConfirm").unbind("click").live("click", function() {
							CloseAllMenu();
							SubmitAgain()
						});
						$("#divForSuccess").addClass("delectOrder_error").find("span").html("出错了!");
						$("#pForAlert").html("").html($("#divForAlert p").eq(2).html()).show()
					}
				}
				$("#alertOrderDivNew").show()
			} else {
				$.fn.alert("您还没有登录或登录已过期，请登录后再试！")
			}
		},
		error: function() {}
	})
}

function GetOrderFromProductCode(b, a, c) {
	GetXiaJia(a);
	$.ajax({
		async: false,
		type: "GET",
		cache: false,
		dataType: "html",
		url: "/Order/GetOrderFromProductCode/" + a,
		success: function(d) {
			if(d != "") {
				if(c == "http://shopping.vancl.com/mycart/batchadd") {
					var e = d.split(",");
					var f = "[";
					$(e).each(function(h, g) {
						f += '{sku:"' + g + '",qty:1}';
						if(h < e.length - 1) {
							f += ","
						}
					});
					f += "]";
					window.location.href = c + "?ref=my-order-buy-" + a + "&wishlist=" + f
				} else {
					window.location.href = c + "?ProductID=" + d + "&num=1"
				}
			}
		},
		error: function() {}
	})
}

function GetXiaJia(a) {
	$.ajax({
		async: false,
		type: "GET",
		cache: false,
		dataType: "html",
		url: "/Order/GetXiaJiaProductName/" + a,
		success: function(b) {
			if(b != "") {
				$.fn.alert("对不起" + b + "已下架")
			}
		},
		error: function() {}
	})
}

function ReturnButton(a, c) {
	if(a != "") {
		if($("#" + c + " a[name^='my_IsReturnInfo']").length == 0 && $("#" + c + " li[name^='my_IsReturnInfo'] a").length == 0) {
			$("#" + c).append(a)
		}
	} else {
		var b = $("#" + c).find("li").length;
		if(b == 0) {
			$("#" + c).append("<li style='margin:0;padding:0;'><span style='padding-top:2px;'>不能操作</span></li>")
		}
	}
}

function ShowReturnButtons() {
	var b = "http://returns.vancl.com";
	var a = $("#hidReturnFormCodes").val();
	if(!a) {
		return
	}
	$.ajax({
		type: "POST",
		cache: false,
		dataType: "JSON",
		data: "orderids=" + a,
		url: "/Order/CheckAreExchanges",
		beforeSend: function() {},
		success: function(c) {
			$(c).each(function(g, h) {
				var d = "operation" + h.FormCode;
				var e = "my_IsReturnInfo_Exchange";
				var f = b + "/ExStepOne/StepOne/" + h.FormCode;
				var k = "my_IsReturnInfo_WatchExchange";
				var l = b + "/AcceptList/AcceptListBySearchInfo/" + h.FormCode;
				var j = "";
				if(h.IsExchangable) {
					j += '<li class="track" style="margin:0;" name=' + e + '><a href="' + f + '">办理退换货</a></li>'
				}
				if(h.IsHaveExchange) {
					j += '<li class="track" style="margin:0;" name=' + k + '><a href="' + l + '">查看退换货订单</a></li>'
				}
				ReturnButton(j, d)
			})
		},
		error: function() {}
	})
}

function ShowReturnButtons3() {
	var b = "http://returns.vancl.com";
	var a = $("#hidReturnFormCodes").val();
	if(!a) {
		return
	}
	$.ajax({
		type: "GET",
		cache: false,
		dataType: "JSON",
		data: "orderids=" + a,
		url: "/PublicControls/CheckAreExchanges.ashx",
		beforeSend: function() {},
		success: function(c) {
			$(c).each(function(g, h) {
				var d = "operation" + h.FormCode;
				var e = "my_IsReturnInfo_Exchange";
				var f = b + "/ExStepOne/StepOne/" + h.FormCode;
				var k = "my_IsReturnInfo_WatchExchange";
				var l = b + "/AcceptList/AcceptListBySearchInfo/" + h.FormCode;
				var j = "";
				if(h.IsExchangable) {
					j += '<li class="track" style="margin:0;" name=' + e + '><a href="' + f + '">办理退换货</a></li>'
				}
				if(h.IsHaveExchange) {
					j += '<li class="track" style="margin:0;" name=' + k + '><a href="' + l + '">查看退换货订单</a></li>'
				}
				ReturnButton(j, d)
			})
		},
		error: function() {}
	})
}

function CheckExchange() {
	var a = $("#hidReturnFormCodes").val();
	if(!a) {
		return
	}
	ShowReturnButtons2("/Order/AreOrdersExchangeable", a, "my_IsReturnInfo_Exchange", "/ExStepOne/StepOne/", "办理退换货");
	ShowReturnButtons2("/Order/ExistsExchangeOrders", a, "my_IsReturnInfo_WatchExchange", "/AcceptList/AcceptListBySearchInfo/", "查看退换货订单")
}

function ShowReturnButtons2(f, c, e, b, a) {
	var d = "http://returns.vancl.com";
	$.ajax({
		type: "POST",
		cache: false,
		dataType: "JSON",
		data: "orderids=" + c,
		url: f,
		success: function(g) {
			$(g).each(function(k, l) {
				var h = "operation" + l.FormCode;
				var j = d + b + l.FormCode;
				var m = "";
				if(l.ExchangeableOrExchanged) {
					m += '<li class="track" style="margin:0;" name=' + e + '><a href="' + j + '">' + a + "</a></li>"
				}
				ReturnButton(m, h)
			})
		}
	})
}

function IsShaidan(a, b) {}

function OrderTrackLine(c, d, e, f) {
	var a = GetScreenX(d);
	var b = GetScreenY(d) - 50;
	$("#PostTime").hide();
	document.getElementById("cover").innerHTML = "<div class='zuizong' id='trackDiv' style='position: absolute; top: " + b + "px;z-index:100001;'><div class='title'><p>订单跟踪</p><span><a onclick=\"$('#cover').hide();$('#PostTime').show();$(document).unmask();\" style='cursor:pointer;'>关闭</a></span></div><div class='dingdan' id='info" + c + "'></div><div class='di'><img src='http://i.vanclimg.com/my/2012/order/di.gif' /></div></div>";
	document.getElementById("cover").style.display = "block";
	$.ajax({
		async: false,
		cache: false,
		type: "get",
		dataType: "text",
		url: "/Order/OrderTrackLine/" + c + "?province=" + escape(e) + "&status=" + f,
		data: "",
		beforeSend: function() {
			$("#info" + c).html("<br/><img src='http://i.vanclimg.com/my/2012/order/loading.gif' alt='' />正在读取，请稍候...")
		},
		success: function(g) {
			$("#info" + c).html(g)
		},
		error: function(g) {},
		complete: function(g) {}
	})
}

function GetScreenX(a) {
	var g;
	if(self.pageYOffset) {
		g = self.pageXOffset
	} else {
		if(document.documentElement && document.documentElement.scrollTop) {
			g = document.documentElement.scrollLeft
		} else {
			if(document.body) {
				g = document.body.scrollLeft
			}
		}
	}
	var f = document.documentElement.clientWidth;
	var e = document.documentElement.clientHeight;
	var b = $("#" + a).height();
	var c = $("#" + a).width();
	var d = (f / 2 - 653);
	return d
}

function GetScreenY(a) {
	var g;
	if(self.pageYOffset) {
		g = self.pageYOffset
	} else {
		if(document.documentElement && document.documentElement.scrollTop) {
			g = document.documentElement.scrollTop
		} else {
			if(document.body) {
				g = document.body.scrollTop
			}
		}
	}
	var f = document.documentElement.clientWidth;
	var e = document.documentElement.clientHeight;
	var b = $("#" + a).height();
	var c = $("#" + a).width();
	var d = (e / 2 - 200 + g);
	return d
}

function GetJsonOrderTrack(formcode) {
	var str = "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><th width='27%' scope='col'><b>处理时间</b></th><th width='73%' scope='col'><b>订单跟踪信息</b></th></tr>";
	$.ajax({
		async: false,
		cache: false,
		type: "post",
		dataType: "text",
		url: "/PublicControls/GetOrderTrackInfo.ashx?formcode=" + formcode,
		data: "",
		beforeSend: function() {
			$("#ordertrack").html(str + "</table>")
		},
		success: function(json) {
			var dataObj = eval("(" + json + ")");
			if(dataObj != null && dataObj.status == 200) {
				var formCollection = dataObj.data[formcode];
				$.each(formCollection, function(index, item) {
					if(index == 0) {
						return
					}
					var datetime = item.OccurTime;
					var date = eval(datetime.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
					datetime = date.Format("yyyy-MM-dd hh:mm:ss");
					var description = item.Description;
					str += "<tr><td>" + datetime + "</td><td>" + description + "</td></tr>"
				})
			}
			str += "</table>";
			$("#ordertrack").html(str)
		},
		error: function(XMLHttpRequest) {
			$.fn.alert("加载订单跟踪信息错误")
		},
		complete: function(XMLHttpRequest) {}
	});
	return str
}

function ResetOrderHeight() {
	$(".VerticalContainer").each(function() {
		var a = $(this).children(".VerticalSubContainer:first-child").height();
		$(this).height(a)
	})
}(function() {
	$.extend($.fn, {
		mask: function(f, c) {
			var h = {
				opacity: 0.8,
				z: 10000,
				bgcolor: "#ccc"
			};
			var j = $(document.body);
			var k = {
				top: 0,
				left: 0
			};
			if(this[0] && this[0] !== window.document) {
				j = this;
				k = j.position()
			}
			var b = $('<div class="maskdivgen"> </div>');
			b.appendTo(j);
			var e = j.clientWidth;
			if(!e) {
				e = j.width()
			}
			var d = j.clientHeight;
			if(!d) {
				d = j.height()
			}
			b.css({
				position: "absolute",
				top: k.top,
				left: k.left,
				"z-index": h.z,
				width: e,
				height: d,
				"background-color": h.bgcolor,
				opacity: 0
			});
			if(c) {
				b.addClass(c)
			}
			if(f) {
				var g = $('<div style="position:absolute;border:#6593cf 1px solid; padding:2px;background:#ccca"><div style="line-height:24px;border:#a3bad9 1px solid;background:white;padding:2px 10px 2px 10px">' + f + "</div></div>");
				g.appendTo(b);
				var l = (b.width() - g.width());
				var a = (b.height() - g.height());
				g.css({
					cursor: "wait",
					top: (a / 2 - 2),
					left: (l / 2 - 2)
				})
			}
			b.fadeIn("fast", function() {
				$(this).fadeTo("fast", h.opacity)
			});
			return b
		},
		unmask: function() {
			var a = $(document.body);
			if(this[0] && this[0] !== window.document) {
				a = $(this[0])
			}
			a.find("> div.maskdivgen").fadeOut("fast", 0, function() {
				$(this).remove()
			})
		}
	})
})();